package com.deep.order.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.deep.common.model.dto.mq.SeckillOrderDTO;
import com.deep.common.utils.PageUtils;
import com.deep.order.model.entity.OrderEntity;
import com.deep.order.model.vo.OrderConfirmVO;
import com.deep.order.model.vo.OrderSubmitVO;
import com.deep.order.model.vo.SubmitOrderResponseVO;
import com.deep.order.model.vo.pay.PayAsyncVO;
import com.deep.order.model.vo.pay.PayVO;

import java.util.Map;
import java.util.concurrent.ExecutionException;

/**
 * 订单
 *
 * @author deep
 * @email ${email}
 * @date 2022-01-13 17:13:27
 */
public interface OrderService extends IService<OrderEntity> {

    PageUtils queryPage(Map<String, Object> params);

    /**
     * 确认订单
     */
    OrderConfirmVO confirmOrder() throws ExecutionException, InterruptedException;

    /**
     * 提交并生成订单
     */
    SubmitOrderResponseVO submitOrder(OrderSubmitVO orderSubmitVO);

    /**
     * 获取订单状态
     */
    OrderEntity getOrderByOrderSn(String orderSn);

    /**
     * 关闭订单
     */
    void closeOrder(OrderEntity orderEntity);

    /**
     * 获取当前订单的支付信息
     */
    PayVO getOrderPay(String orderSn);

    /**
     * 获取当前登录用户的订单项
     */
    PageUtils queryPageWithItem(Map<String, Object> params);

    /**
     * 支付处理
     */
    String handlePayResult(PayAsyncVO payAsyncVO);

    /**
     * 创建秒杀时产生的订单
     */
    void createSeckillOrder(SeckillOrderDTO orderDTO);
}

